<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

    <title>My JSP 'SurveyAudi.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">

    <link rel="stylesheet" type="text/css" href="../Css/Admin.css">
    <script language="JavaScript" src="../Js/Func.js"></script>
    <script language="JavaScript" src="${pageContext.request.contextPath}/Js/jquery-1.7.2.js"></script>
    <script language="javascript">window.onload = tableFix;</script>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/Css/bootstrap.min.css">
    <script type="text/javascript">
        function DelAdmin(aid) {
            if (confirm("确定要删除这个用户吗？") == true){
                $.post(
                    "/admin/delete?id=" + aid,
                    function (data) {
                        if(data.code==200){
                            alert("删除成功");
                            window.location.href="/admin/adminList";
                        }else{
                            alert("删除失败");
                        }
                    },"json"
                );
            }
/*
                window.location = "/admin/delete?id=" + aid;
*/
        }
    </script>
</head>

<body>
<div class=nav><a href=admin_main.jsp>桌面</a>»管理员列表
</div>
<table class=table cellspacing="0" cellpadding="0" align="center">
    <tbody>
    <tr>
        <th width=7%>编号</th>
        <th width=20%>用户名</th>
        <th width=20%>联系方式</th>
        <th width=20%>邮箱</th>
        <th width=15%>密码 <br></th>
        <th>操作 <br></th>
    </tr>
    <c:forEach var="admin" items="${pageBean.list}">
        <tr>
            <td>${admin.id} </td>
            <td>${admin.user}</td>
            <td>${admin.phone}</td>
            <td>${admin.email}</td>
            <td>${admin.password}</td>
<%--
            <a href=${pageContext.request.contextPath}/admin/search?aid=${admin.id}>编辑用户</a>
--%>
            <td><a href='javascript:DelAdmin(${admin.id})'>删除</a></td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div class="pull-right">
    <script type="text/javascript">
        function page(pageCode) {
            window.location.href = "${pageContext.request.contextPath}/admin/adminList?pageCode=" + pageCode + "&search=" + search;
        }
    </script>
    <jsp:include page="/page.jsp"></jsp:include>
</div>
</body>
</html>
